﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Systemudvikling___Larman_Projekt___06._02._2012_
{
    public class Register
    {
        // Commit testing TMP
        private ProductCatalog catalog;
        private Sale currentSale;
        private ProductDescription desc;

        public Register(ProductCatalog catalog)
        {
            this.catalog = catalog;
        }

        public void endSale()
        {
            currentSale.becomeComplete();
        }

        public void enterItem(int id, int quantity)
        {
            desc = catalog.getProductDescription(id);
            currentSale.makeLineItem(desc, quantity);
        }
        // DETTE ER EN METODE VI LAVEDE FOR AT KUNNE HENTE SALETOTAL UD DA
        // CURRENTSALE ER PRIVATE OG DERFOR IKKE KAN TILGÅES FRA MAIN()
        public double GetTotal()
        {
            return currentSale.getTotal();
        }

        public void makeNewSale() 
        {
            currentSale = new Sale();
        }

        public void makePayment(double cashTendered)
        {
            currentSale.makePayment(cashTendered);
        }
    }
}
